
* Busch and Pelc. WordsMatter.

* set dir "~\BuPe_words_replication"

use "BuPe_words_claim.dta", clear

* Figure 1. Distribution of Affect Across Rulings
 histogram  normal_Rnew_affect_total
 histogram  normal_ABnew_affect_total

* Figure 2: Average Affect Across Agreements
graph dot (mean) normal_Rnew_affect  normal_ABnew_affect  if provision!="Annex 1" & provision!="Annex B" & provision!="Annex C" & provision!="Annex I" & provision!="Annex II" & provision!="Government Procurement" & provision!="DSU" & provision!="Import Licensing" & provision!="WTO", over(provision, sort(1) descending) title ("Affect by Legal Issue",  span) note("" , span)   exclude0 yscale(range(0.04 (0.01) 0.08))  ylabel(0.04[0.01]0.08)    


* Table 1. 
  
keep if provision=="GATT" & claim=="III:2" |  provision=="GATT" & claim=="III:4"
duplicates drop dispute claim, force
save "BuPe_words_GATTiiionly.dta", replace


* Combine R and AB rulings combined by appending one to the other. 
drop    normal_ABnew_affect_total
gen level="R"
gen panel=1
gen normal_affect= normal_Rnew_affect_total
save "panels_affect.dta", replace

use  "BuPe_words_GATTiiionly.dta", clear
drop  normal_Rnew_affect_total
gen level="AB"
gen ab=1
gen normal_affect= normal_ABnew_affect_total

append using "panels_affect.dta"

replace ab=0 if panel==1
replace panel=0 if ab==1
 
* gen percent DV
gen normal_affect100= normal_affect*100

 * Run GATTIII estimations.

* c1
reg normal_affect100 GATT_III4 , cluster(dispute_combined)
est store m1

mfx compute, at(mean GATT_III4=0  )
mfx compute, at(mean GATT_III4=1  )
di (.06361049 - .05631845) / .05631845
* change of 13%

* c2
reg normal_affect100 GATT_III4 US_EU_def ab bs*, cluster(dispute_combined)
est store m2

* c3
sort dispute
merge dispute using  "C_affect.dta"
reg normal_affect100 GATT_III4 US_EU_def ab C_nogatt_affect_normal bs*, cluster(dispute_combined)
est store m3

esttab m1 m2 m3 using affect_table1.tex, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) star(* 0.10 ** 0.05 *** 0.01) label title(Affect in WTO National Treatment Rulings \label{affect}) style(tex) compress legend varlabels(_cons Constant)   stats(N r2, fmt(0 2 3) label(N  )) 

mfx compute, at(mean ab=0  )
mfx compute, at(mean ab=1  )
di (.06519494 - .05907673) / .05907673
* 10% more for AB rulings


* Appendix: Table 3 Descriptives "GATT III Claims Sample" (top panel)

quietly reg normal_affect100 GATT_III4 , cluster(dispute_combined)

estpost tabstat normal_affect100 GATT_III4 precedents   US_EU_def year  if e(sample), by(ab)  statistics(mean sd n) columns(statistics) listwise

esttab using descriptives1.tex, replace main(mean) aux(sd) nostar unstack  style(tex) 


* Table 2. 

use "BuPe_words_claim.dta", clear

* Combine R and AB rulings by appending one to the other. 
drop normal_ABnew_affect_total
gen level="R"
gen panel=1
gen won=panelwon
gen normal_affect= normal_Rnew_affect_total
save "panels_affect.dta", replace

use  "BuPe_words_claim.dta", clear
drop  normal_Rnew_affect_total
gen level="AB"
gen ab=1
		gen won=abwon
gen normal_affect= normal_ABnew_affect_total

append using "panels_affect.dta"

replace ab=0 if panel==1
replace panel=0 if ab==1

* gen percent DV
gen normal_affect100= normal_affect*100

* Run Precedent estimations.

reg normal_affect100 precedents ab if won!=. , cluster(dispute_combined) 
* "if won!=." constrains the sample to claims that were ruled on. 
est store m1

reg normal_affect100 precedents ab  US_EU_def bs* if won!=., cluster(dispute_combined) 
est store m2

areg normal_affect100 precedents ab  US_EU_def bs* if won!=., cluster(dispute_combined)  abs(provision)
est store m3

 esttab m1 m2 m3 using affect_table2.tex, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) star(* 0.10 ** 0.05 *** 0.01) label title(Legal Novelty and Affect in WTO Rulings \label{affect}) style(tex) compress legend varlabels(_cons Constant)   stats(N r2, fmt(0 2 3) label(N  )) 
 
 
* robustness

bysort  dispute: gen claimsnum=_N

areg normal_affect100 precedents ab  US_EU_def bs* claimsnum if won!=., cluster(dispute_combined)  abs(respondent)

areg normal_affect100 precedents ab won  US_EU_def bs* claimsnum if won!=., cluster(dispute_combined)  abs(respondent)


* Appendix: Table 3 Descriptives "All WTO Claims Sample" (bottom panel)

estpost tabstat normal_affect100 precedents   US_EU_def claimsnum year if e(sample), by(ab)  statistics(mean sd n) columns(statistics) listwise

esttab using descriptives2.tex, replace main(mean) aux(sd) nostar unstack  style(tex) 



